              package com.java.diagnostics.visualizer.displayer.plot;
              
              import com.java.diagnostics.visualizer.coredisplayers.CoreDisplayersPreferenceInitalizer;
              import com.java.diagnostics.visualizer.coredisplayers.util.Messages;
              import com.java.diagnostics.visualizer.impl.preferences.GCAndMemoryVisualizerPreferenceInitializer;
              import com.java.diagnostics.visualizer.impl.preferences.SmartPreferences;
              import org.osgi.service.prefs.Preferences;
              
              public class LinePlotPreferenceHelper
              {
                private SmartPreferences preferences;
                public static final String LINE_THICKNESS = LinePlotPreferenceHelper.class + "LineThickness";
                public static final String DRAW_LEGEND = LinePlotPreferenceHelper.class + "DrawLegend";
                public static final String DRAW_DATA_LEGEND = LinePlotPreferenceHelper.class + "DrawDataLegend";
                public static final String LEGEND_POSITION = LinePlotPreferenceHelper.class + "LegendPosition";
                public static final String PAD_PLOTS = LinePlotPreferenceHelper.class + "PadPlots";
                public static final String POINT_SENSITIVITY_RADIUS = LinePlotPreferenceHelper.class + "CursorFuzziness";
                public static final String FORCE_Y_AXIS_START_AT_ZERO = LinePlotPreferenceHelper.class + "ForceYAxisStartAtZero";
                public static final String IMAGE_FORMAT = LinePlotPreferenceHelper.class + "ImageFormat";
                public static final String JPG_EXTENSION = ".jpg";
                public static final String PNG_EXTENSION = ".png";
                public static final String BMP_EXTENSION = ".bmp";
                private static final String[] imageFormats = { Messages.getString("LinePlotPreferenceHelper.jpeg"), Messages.getString("LinePlotPreferenceHelper.png"), Messages.getString("LinePlotPreferenceHelper.bmp") };
              
                public LinePlotPreferenceHelper()
                {
                  this.preferences = CoreDisplayersPreferenceInitalizer.getInstance().getPreferences();
                }
              
                public int getLineThickness()
                {
	              // deleted by wenguang.huang 
                  //     return this.preferences.getInt(LINE_THICKNESS);
	              return 1; 
                }
              
                public boolean getDrawLegend()
                {
	          // deleted by wenguang.huang 
                  //     return this.preferences.getBoolean(DRAW_LEGEND);
	          //added by wenguang.huang 
              return true;
			  //added end by wenguang.huang 


              
                }
              
                public boolean getDrawDataLegend()
                {
	          // deleted by wenguang.huang 
                  //     return this.preferences.getBoolean(DRAW_DATA_LEGEND);
	          //added by wenguang.huang 
              return true;
			  //added end by wenguang.huang 


                }
              
                public void setDrawDataLegend(boolean drawDataLegend) {
                  this.preferences.setValue(DRAW_DATA_LEGEND, drawDataLegend);
                }
              
                public int getLegendPosition()
                {
                  return this.preferences.getInt(LEGEND_POSITION);
                }
              
                public int getCursorFuzziness()
                {
	          // deleted by wenguang.huang 
                   //    return this.preferences.getInt(POINT_SENSITIVITY_RADIUS);
	          //added by wenguang.huang 
               return 5;
			  //added end by wenguang.huang 


                }
              
                public boolean getPadPlots()
                {
                  return this.preferences.getBoolean(PAD_PLOTS);
                }
              
                public static void initializeDefaults(Preferences preferences)
                {
                  preferences.putBoolean(DRAW_LEGEND, true);
                  preferences.putBoolean(DRAW_DATA_LEGEND, true);
                  preferences.putInt(LINE_THICKNESS, 1);
                  preferences.putBoolean(PAD_PLOTS, true);
                  preferences.putInt(LEGEND_POSITION, 0);
                  preferences.putInt(POINT_SENSITIVITY_RADIUS, 10);
                  preferences.putBoolean(FORCE_Y_AXIS_START_AT_ZERO, true);
                  preferences.putInt(IMAGE_FORMAT, 0);
                }
              
                public boolean getForceYAxisToStartAtZero() {
	          // deleted by wenguang.huang 
                  //     return this.preferences.getBoolean(FORCE_Y_AXIS_START_AT_ZERO);
	          //added by wenguang.huang 
                return true;
			  //added end by wenguang.huang 


                }
              
                public int getImageFormat()
                {
	          // deleted by wenguang.huang 
//          switch (this.preferences.getInt(IMAGE_FORMAT)) { case 0:
//            return 4;
//          case 1:
//            return 5;
//          case 2:
//            return 0; }
                  return 5;
                }
              
                public String getImageFormatExtension()
                {
                  switch (getImageFormat()) { case 4:
                    return ".jpg";
                  case 5:
                    return ".png";
                  case 0:
                    return ".bmp";
                  case 1:
                  case 2:
                  case 3: } return ".jpg";
                }
              
                public static String[] getImageFormats()
                {
                  return imageFormats;
                }
              }

